﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Automobile.service.BLL;
using Automobile.service.Model;
using Automobile.service.Common;
namespace Automobile.service.UI
{
    public partial class Purchaseslist : System.Web.UI.Page
    {
        PurchaseBLL bll = new PurchaseBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
               
                load();
            }
        }

        private void load()
        {
            AspNetPager1.PageSize = 3;
            string firstdate = this.datemin.Value;
            string lastdate = this.datemax.Value;
            int count;
            Repeater1.DataSource = bll.SearchPurchaseByDate(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize,firstdate,lastdate,out count);
            Repeater1.DataBind();
            Label1.Text = count.ToString();
            AspNetPager1.RecordCount = count;
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            load();
        }

        protected void Unnamed_ServerClick(object sender, EventArgs e)
        {
            load();
        }
    }
}